home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group94a.txt
/
000093_icon-group-sender _Fri Apr 22 13:06:56 1994.msg
< prev
next >
Wrap
Internet Message Format
|
1994-08-19
|
2KB
Received: by cheltenham.cs.arizona.edu; Fri, 22 Apr 1994 09:14:03 MST
Date: Fri, 22 Apr 1994 13:06:56 +0100
From: Jan Peter de Ruiter <janpeter@mpi.nl>
Message-Id: <9404221206.AA25564@mpix10.mpi.kun.nl>
To: icon-group@cs.arizona.edu
Subject: is this a bug?
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
Hi Icon folks,
I hope someone can help me out with this.
I had a terrible bug in a program, and it was caused
by the following phenomenon:
------- example program -------------
link ximage
procedure main()
t := table([]) # a table with default element []
every put(t[1],generate(1,5)) # fill t[1], which is empty list
every put(t[2],generate(6,9)) # fill t[2], which is empty list
every(write(!t[1])) # write out all elements of t[1]
write()
every(write(!t[2])) # write out all elements of t[2]
write(ximage(t)) # write out image of t
end
procedure generate(a,b)
every suspend (a to b)
end
-------- end example program -----------
Now I expected that t[1] would be [1,2,3,4,5] and
t[2] would be [6,7,8,9]. However, the output was:
--------- program output ---------------
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
T1 := table({L1 := list(9)
L1[1] := 1
L1[2] := 2
L1[3] := 3
L1[4] := 4
L1[5] := 5
L1[6] := 6
L1[7] := 7
L1[8] := 8
L1[9] := 9
L1})
--------- end program output -------------
It seems there is actually one list here, with
both t[1] and t[2] pointing to it. This was
not what I expected.
Now my question is: have I understood the icon
semantics wrongly, or is this a bug? If anyone
understands what is happening here, could (s)he
please explain?
Thanks in advance,
Jan
janpeter@mpi.kun.nl